package com.aaa.service.Impl;

import com.aaa.entity.Orders;
import com.aaa.mapper.OrdersMapper;
import com.aaa.service.OrdersService;
import com.aaa.util.DefaultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    private OrdersMapper ordersMapper;
    @Override
    public List<Orders> listAll(String keyword) {
        return ordersMapper.listAll(keyword);
    }

    @Override
    public DefaultMsg delete(Integer oid) {
        DefaultMsg defaultMsg=new DefaultMsg();
        Integer delete = ordersMapper.delete(oid);
        if (delete==0){
            defaultMsg.setSuccess(0);
            defaultMsg.setMsg("删除失败");
        }
        return defaultMsg;
    }
}
